package com.herench.bs.handler;

import com.herench.bs.agent.IPersonAgent;
import com.herench.bs.annotation.Handler;
import com.herench.bs.support.AbstractMessageHandler;
import com.herench.bs.support.RequestMessage;
import com.herench.bs.support.ResponseMessage;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.util.Map;

/**
 * cleverClinic
 * com.herench.bs.handler
 *
 * @author wangwenkai
 * @date 2018/1/4/16:23
 * 删除收藏
 */
@Component
@Handler(code = "100603" ,name="取消收藏")
public class DeleteEnshrineHandler extends AbstractMessageHandler {
    @Override
    protected ResponseMessage innerHandler(RequestMessage requestMessage) throws Exception {
        ResponseMessage responseMessage = new ResponseMessage(requestMessage.getId());
        String collectContent = requestMessage.getArgsPropertyStringValue("docId");
        Assert.notNull(collectContent,"collectContent 为空");
        String userId = requestMessage.getArgsPropertyStringValue("user");
        IPersonAgent agent = getCleverClinicContext().getApplicationContext().getBean(IPersonAgent.class);
        Map<String, Object> res = agent.deleteEnshrine(collectContent,userId);
        responseMessage.setData(res);
        getPropertiesFromInvokerResultMap(responseMessage, res);
        return responseMessage;
    }
}
